package yong.birthdayreminder;

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TabHost;
import android.widget.TextView;
import android.view.View;

/**
 * Example of using a tab content factory for the content via {@link TabHost.TabSpec#setContent(android.widget.TabHost.TabContentFactory)}
 *
 * It also demonstrates using an icon on one of the tabs via {@link TabHost.TabSpec#setIndicator(CharSequence, android.graphics.drawable.Drawable)}
 *
 */
public class MainActivity extends TabActivity implements TabHost.TabContentFactory {


    @Override
	protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);


        final TabHost tabHost = getTabHost();
        Intent intent1 = new Intent();
        intent1.putExtra("aweek", "7");
        intent1.setClass(this, CurrentBithdayBuddyActivity.class);
        tabHost.addTab(tabHost.newTabSpec("tab1")
                .setIndicator(this.getString(R.string.tab_thisweekbuddy), getResources().getDrawable(android.R.drawable.star_big_on))
                .setContent(intent1));
        Intent intent2 = new Intent();
        intent2.putExtra("amonth", "30");
        intent2.setClass(this, CurrentBithdayBuddyActivity.class);
        tabHost.addTab(tabHost.newTabSpec("tab2")
                .setIndicator(this.getString(R.string.tab_thismonthbuddy), getResources().getDrawable(android.R.drawable.star_big_on))
                .setContent(intent2));
        Intent intent = new Intent();
        intent.setClass(this, BuddyMgtActivity.class);
        tabHost.addTab(tabHost.newTabSpec("tab3")
                .setIndicator(this.getString(R.string.tab_management), getResources().getDrawable(android.R.drawable.ic_input_add))
                .setContent(intent));
        
        Intent intent4 = new Intent();
        intent4.setClass(this, AboutActivity.class);
        tabHost.addTab(tabHost.newTabSpec("tab4")
                .setIndicator("", getResources().getDrawable(android.R.drawable.ic_menu_help))
                .setContent(intent4));
    }

    /** {@inheritDoc} */
    @Override
	public View createTabContent(String tag) {
        final TextView tv = new TextView(this);
        tv.setText("Content for tab with tag " + tag);
        return tv;
    }
}
